package cn.fzkj.controller;

import cn.fzkj.helper.FileHelper;
import cn.fzkj.model.UploadResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ author mr
 * @ description
 * @ since 2024/11/5
 */
@RestController
@RequestMapping("/api/common/oss")
public class OssController {

    @Autowired
    private FileHelper fileHelper;

    @GetMapping("/upload")
    public UploadResult upload(MultipartFile file) {
        return fileHelper.upload(file);
    }

    @GetMapping("/file/delete")
    public boolean delete(String key) {
        fileHelper.delete(key);
        return true;
    }
}
